<include file="../Public/_header" />
<div class="so_main">
  <div class="page_tit">用户认证</div>
  <div class="tit_tab">
    <ul>
	  <li><a href="{:U('admin/User/verified', array('verified'=>'0'))}"<eq
		  name="verified" value="0">class="on"</eq>>待认证</a></li>
	  <li><a href="{:U('admin/User/verified', array('verified'=>'1'))}"<eq
		  name="verified" value="1">class="on"</eq>>已认证</a></li>
	  <li><a href="{:U('admin/User/addVerifiedUser')}">添加认证</a></li>
    </ul>
  </div>
  <!-------- 搜索用户 -------->
  <div id="searchUser_div" <neq name="type" value="searchUser">style="display:none;"</neq>>
  	<div class="page_tit">搜索用户 [ <a href="javascript:void(0);" onclick="searchUser();">隐藏</a> ]</div>
	
	<div class="form2">
	<form method="post">
	<php>if($type != 'searchUser') $uid = '';</php>
    <dl class="lineD">
      <dt>用户ID：</dt>
      <dd>
        <input name="uid" id="uid" type="text" value="{$uid}">
        <p>用户ID,多个时使用英文的","分割</p>
      </dd>
    </dl>
	
    <dl class="lineD">
      <dt>真实姓名：</dt>
      <dd>
        <input name="realname" id="realname" type="text" value="{$realname}">
        <p>支持模糊查询</p>
      </dd>
    </dl>

    <dl class="lineD">
      <dt>手机号：</dt>
      <dd>
        <input name="phone" id="phone" type="text" value="{$phone}">
        <p>支持模糊查询</p>
      </dd>
    </dl>

    <dl class="lineD">
      <dt>认证原因：</dt>
      <dd>
        <input name="reason" id="reason" type="text" value="{$reason}">
        <p>支持模糊查询</p>
      </dd>
    </dl>
    <div class="page_btm">
      <input type="submit" class="btn_b" value="确定" />
    </div>
	</form>
  </div>
  </div>
  
  <!-------- 用户列表 -------->
  <div class="Toolbar_inbox">
  	<div class="page right">{$html}</div>
	<a href="javascript:void(0);" class="btn_a" onclick="searchUser();">
		<span class="searchUser_action"><neq name="type" value="searchUser">搜索用户<else/>搜索完毕</neq></span>
	</a>
	<eq name="verified" value="0">
		<a href="javascript:void(0);" class="btn_a" onclick="c.verified()"><span>通过认证</span></a>
		<a href="javascript:void(0);" class="btn_a" onclick="c.del()"><span>驳回认证</span></a>
	<else />
		<a href="javascript:void(0);" class="btn_a" onclick="c.del()"><span>取消认证</span></a>
	</eq>
  </div>
  <div class="list">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th style="width:30px;">
		<input type="checkbox" id="checkbox_handle" onclick="checkAll(this)" value="0">
    	<label for="checkbox"></label>
	</th>
    <th class="line_l">ID</th>
    <th class="line_l">用户信息</th>
    <th class="line_l">真实姓名</th>
    <th class="line_l">手机号</th>
    <th class="line_l" width="350">认证原因</th>
	<eq name="verified" value="1"><th class="line_l" width="350">认证资料</th></eq>
    <th class="line_l">状态</th>
    <th class="line_l">操作</th>
  </tr>
  <volist id="vo" name="data">
	  <tr overstyle='on' id="user_{$vo['uid']}">
	    <td><input type="checkbox" name="checkbox" id="checkbox2" onclick="checkon(this)" value="{$vo.uid}"></td>
	    <td>{$vo.uid}</td>
	    <td>
			<div style="float:left;margin-right:10px;border:1px solid #8098A8;padding:1px;"><space uid="vo.uid" target="_blank">{uavatar=s}</space></div>
			<div style="float:left"><space uid="vo.uid" class="fn" target="_blank">{uname}</space><br>{$vo.email}</div></td>
		<td>{$vo.realname}</td>
	    <td>{$vo.phone}</td>
	    <td>{$vo.reason}</td>
	    <eq name="verified" value="1"><td>{$vo.info}</td></eq>
	    <td><eq name="vo['verified']" value="0">待认证<else/>已认证</eq></td>
	    <td>
	    	<eq name="vo['verified']" value="0">
				<a href="javascript:void(0)" onclick="c.verified({$vo.uid})">通过</a>
				<a href="javascript:void(0)" onclick="c.del({$vo.uid})">驳回</a>
	    	<else />
	    		<a href="{:U('admin/User/addVerifiedUser', array('uid'=>$vo['uid']))}">编辑</a>
	    		<a href="javascript:void(0)" onclick="c.del({$vo.uid})">取消</a>
	    	</eq>
		</td>
	  </tr>
  </volist>
  </table>
  </div>
  <div class="Toolbar_inbox">
  	<div class="page right">{$html}</div>
	<a href="javascript:void(0);" class="btn_a" onclick="searchUser();">
		<span class="searchUser_action"><neq name="type" value="searchUser">搜索用户<else/>搜索完毕</neq></span>
	</a>
	<eq name="verified" value="0">
		<a href="javascript:void(0);" class="btn_a" onclick="c.verified()"><span>通过认证</span></a>
		<a href="javascript:void(0);" class="btn_a" onclick="c.del()"><span>驳回认证</span></a>
	<else />
		<a href="javascript:void(0);" class="btn_a" onclick="c.del()"><span>取消认证</span></a>
	</eq>
  </div>
<script>
	//鼠标移动表格效果
	$(document).ready(function(){
		$("tr[overstyle='on']").hover(
		  function () {
		    $(this).addClass("bg_hover");
		  },
		  function () {
		    $(this).removeClass("bg_hover");
		  }
		);
	});

	//搜索用户
	var isSearchHidden = <neq name="type" value="searchUser">1<else/>0</neq>;
	function searchUser() {
		if(isSearchHidden == 1) {
			$("#searchUser_div").slideDown("fast");
			$(".searchUser_action").html("搜索完毕");
			isSearchHidden = 0;
		}else {
			$("#searchUser_div").slideUp("fast");
			$(".searchUser_action").html("搜索用户");
			isSearchHidden = 1;
		}
	}

	function checkon(o){
		if( o.checked == true ){
			$(o).parents('tr').addClass('bg_on') ;
		}else{
			$(o).parents('tr').removeClass('bg_on') ;
		}
	}

	function checkAll(o){
		if( o.checked == true ){
			$('input[name="checkbox"]').attr('checked','true');
			$('tr[overstyle="on"]').addClass("bg_on");
		}else{
			$('input[name="checkbox"]').removeAttr('checked');
			$('tr[overstyle="on"]').removeClass("bg_on");
		}
	}

	//获取已选择用户的ID数组
	function getChecked() {
		var uids = new Array();
		$.each($('table input:checked'), function(i, n){
			var val = $(n).val();
			if (val > 0) {
				uids.push( $(n).val() );
			}
		});
		return uids;
	}

	var ctrl = function(){
	}
	ctrl.prototype = {
	    del:function(uid)
	    {
	        ui.box.load( '{:U('admin/User/deleteVerifiedTab')}' + '&uid=' + uid + '&verified=<?php echo $verified; ?>',{title:'取消认证'});
	    },
	    verified:function(id)
	    {
	        ui.box.load( '{:U('admin/User/doVerifiedTab')}' + '&uid=' + id,{title:'请填写认证资料：'});
	    }
	}
	var c = new ctrl();
</script>
<include file="../Public/_footer" />